#include<iostream>
#include<ctime>
#include "ThreadPool.hpp"
#include "Task.hpp" 

int main()
{
    //ThreadPool<Task>*tp=new ThreadPool<Task>(5);
    //tp->Start();
    ThreadPool<Task>::GetInstance()->Start();//单例模式
    srand(time(nullptr));
    while(true)
    {
        //构建任务
        int x=rand()%10+1;
        usleep(1000);
        int y =rand()%5;
        int len=opers.size();
        char op=opers[rand()%len];
        Task t(x,y,op);
        ThreadPool<Task>::GetInstance()->Push(t);
        //交给线程池处理
        cout<<"main thread make a task: "<<t.GetTask()<<endl;
        sleep(1);
    }
    return 0;
}